/**
 * Copyright (c) 2024-2025 National Fundamental Software of China Co., Ltd.
 *
 * You should have find a copy of NFSChina License. If not, please contact us
 * by email <os_support@nfschina>
 *
**/

/*
    SPDX-FileCopyrightText: 2020 Tobias Fella <fella@posteo.de>

    SPDX-License-Identifier: GPL-2.0-or-later
*/

import QtQuick 2.12
import QtQuick.Layouts 1.15

import org.kde.kirigami 2.7 as Kirigami
import org.kde.kcm 1.5 as KCM
import org.kde.plasma.core 2.0 as PlasmaCore

KCM.SimpleKCM {
    Kirigami.FormLayout {
        id: form
        property bool lighttheme:PlasmaCore.Theme.viewBackgroundColor=="#ffffff" 

        property var backgroundcolor: PlasmaCore.Theme.viewBackgroundColor
        property var textcolor:PlasmaCore.Theme.textColor
        property var bordercolor:lighttheme?"#CCCCCC":"#2D2D2D"


        // readonly property int longestComboBox: Math.max(webBrowserCombo.implicitWidth,
        //                                                 mailCombo.implicitWidth,
        //                                                 calendarCombo.implicitWidth,
        //                                                 musicCombo.implicitWidth,
        //                                                 videoCombo.implicitWidth,
        //                                                 imageCombo.implicitWidth,
        //                                                 textEditorsCombo.implicitWidth)
        readonly property int longestComboBox: 558
        readonly property int highestComboBox: 48
        //选择默认网页浏览器

        



        ComponentComboBox {
            id: webBrowserCombo

            Layout.preferredWidth: form.longestComboBox
            Layout.preferredHeight: form.highestComboBox

            component: kcm.browsers
            label: i18n("Web")

            KCM.SettingHighlighter {
                highlight: !kcm.browsers.isDefaults
            }
        }
        //选择默认邮件客户端
        ComponentComboBox {
            id: emailCombo

            Layout.preferredWidth: form.longestComboBox
            Layout.preferredHeight: form.highestComboBox
            component: kcm.emailClients
            label: i18n("Mail")

            KCM.SettingHighlighter {
                highlight: !kcm.emailClients.isDefaults
            }
        }

        //选择默认日历插件
        ComponentComboBox {
            id: calendarCombo

            Layout.preferredWidth: form.longestComboBox
            Layout.preferredHeight: form.highestComboBox
            component: kcm.calendarClients
            label: i18n("Calendar")

            KCM.SettingHighlighter {
                highlight: !kcm.calendarClients.isDefaults
            }
        }
        //选择默认音乐播放器
        ComponentComboBox {
            id: musicCombo

            Layout.preferredWidth: form.longestComboBox
            Layout.preferredHeight: form.highestComboBox
            component: kcm.musicClients
            label: i18n("Music")

            KCM.SettingHighlighter {
                highlight: !kcm.musicClients.isDefaults
            }
        }

        //选择默认视频播放器
        ComponentComboBox {
            id: videoCombo

            Layout.preferredWidth: form.longestComboBox
            Layout.preferredHeight: form.highestComboBox
            component: kcm.videoClients
            label: i18n("Video")

            KCM.SettingHighlighter {
                highlight: !kcm.videoClients.isDefaults
            }
        }
        //选择默认图片启动应用
        ComponentComboBox {
            id: imageCombo

            Layout.preferredWidth: form.longestComboBox
            Layout.preferredHeight: form.highestComboBox
            component: kcm.imageClients
            label: i18n("Image")
            KCM.SettingHighlighter {
                highlight: !kcm.imageClients.isDefaults
            }
        }
        //选择默认文本编辑器
        ComponentComboBox {
            id: textEditorsCombo

            Layout.preferredWidth: form.longestComboBox
            Layout.preferredHeight: form.highestComboBox
            component: kcm.textEditors
            label: i18n("Text")

            KCM.SettingHighlighter {
                highlight: !kcm.textEditors.isDefaults
            }
        }
        
        ComponentComboBox {
            id: terminalCombo

            Layout.preferredWidth: form.longestComboBox
            Layout.preferredHeight: form.highestComboBox

            component: kcm.terminalEmulators
            label: i18n("Terminal emulator")

            KCM.SettingHighlighter {
                highlight: !kcm.terminalEmulators.isDefaults
            }
        }

        ComponentComboBox {
            id: filemanagerCombo

            Layout.preferredWidth: form.longestComboBox
            Layout.preferredHeight: form.highestComboBox

            component: kcm.fileManagers
            label: i18n("File manager")

            KCM.SettingHighlighter {
                highlight: !kcm.fileManagers.isDefaults
            }
        }


	/*
        ComponentComboBox {
            id: mapCombo

            Layout.preferredWidth: form.longestComboBox

            component: kcm.geoUriHandlers
            label: i18n("Map:")

            KCM.SettingHighlighter {
                highlight: !kcm.geoUriHandlers.isDefaults
            }
        }
        ComponentComboBox {
            id: dialerCombo

            Layout.preferredWidth: form.longestComboBox

            component: kcm.telUriHandlers
            label: i18nc("Default phone app", "Dialer:")

            KCM.SettingHighlighter {
                highlight: !kcm.telUriHandlers.isDefaults
            }
        }
	
        ComponentComboBox {
            id: terminalCombo

            Layout.preferredWidth: form.longestComboBox

            component: kcm.terminalEmulators
            label: i18n("Terminal emulator:")

            KCM.SettingHighlighter {
                highlight: !kcm.terminalEmulators.isDefaults
            }
        }
    */
        
    }
}
